package com.contract.spirit.ui.main.first.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.contract.spirit.R
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.contract.spirit.bean.entity.RankInfo
import com.contract.spirit.databinding.AdapterFirstpageRankItemBinding
import java.util.ArrayList

/**
 * @author zhengjun
 * @desc
 * @create at 2021/6/19 10:51
 */
class FirstPageRankAdapter :
    BaseQuickAdapter<RankInfo, BaseDataBindingHolder<AdapterFirstpageRankItemBinding>>(
        R.layout.adapter_firstpage_rank_item,
        ArrayList()
    ) {
    override fun convert(
        holder: BaseDataBindingHolder<AdapterFirstpageRankItemBinding>,
        item: RankInfo
    ) {
        val dataBinding = holder.dataBinding;
        val adapterPosition = holder.adapterPosition
        dataBinding?.apply {
            item.adapterPosition = adapterPosition
            item.rankType = rankType;
            dataBinding.rankInfo = item;
        }
    }

    private var rankType: String? = null
    fun setRankType(rankType: String?) {
        this.rankType = rankType
    }
    companion object {
        const val INVITE = "invite" //邀请
        const val OPEN = "open" //开仓
        const val COMPENSATED = "Compensated" //获赔
    }
}